﻿@using Models
@model WorkflowInstance
@{
    ViewBag.Title = "预跑";
    Layout = "~/Views/Shared/_Master.cshtml";
}
<link href="@Url.Content("~/Content/jquery-ui-1.8.17.custom.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Scripts/jquery.wysiwyg.css")" rel="stylesheet" type="text/css" />
<script type="text/javascript">
    $(document).ready(function () {
        previewprocess();
    });
</script>
<h1>
    流程预跑</h1>
@using (Html.BeginForm())
{
    @Html.Hidden("workflowid", Model.WorkflowID);
    <fieldset class="preview-fieldset">
        <legend>流程发起人信息</legend>
        <table class="pre-table">
            <tr>
                <td>
                    <span>
                        <label>
                            发起人：</label><input id="app-applyer" name="app-applyer" class="pre-applyer dyn-text"
                                type="text" /></span>
                </td>
                <td>
                    <span>
                        <label>
                            发起人部门</label><input id="app-department" name="app-department" class="pre-department dyn-text"
                                type="text" /></span>
                </td>
                <td>
                    <span>
                        <label>
                            代发人:</label><input id="app-proxy" name="app-proxy" class="pre-proxyapplyer dyn-text"
                                type="text" /></span>
                </td>
                <td>
                    <span>
                        <label>
                            职级：</label><input id="app-level" name="app-level" class="dyn-text" type="text" /></span>
                </td>
            </tr>
        </table>
    </fieldset>
    <fieldset class="preview-fieldset">
        <legend>流程表单信息</legend>
        <table style="width: 100%">
            <tr>
                <td class="pre-formtd" colspan="4">
                    <ul class="pre-form">
                      @{
                        if (Model.Workflow != null && Model.Workflow.Fields != null)
                        {
                            foreach (var f in Model.Workflow.Fields)
                            {
                            <li id=@f.FieldName fieldwidth=@f.FieldWidth controltype="@f.ControlType" >
                                <div>
                                    <label class="dyn-fieldname" style="width: 100%">@f.FieldName</label>：
                                </div>
                                @if (f.ControlType == "text" || f.ControlType == "peoplefinder" || f.ControlType == "datepicker" || f.ControlType == "number")
                                {
                                    
                                    <div>
                                        <input id=@f.FieldName name=@f.FieldName  type="text" class="dyn-text" />
                                    </div>
                                }
                                else if (f.ControlType == "singleselection")
                                { 
                                    <div class="singleselection">
                                        @if (f.OptionValue != null)
                                        {
                                            @Html.Hidden(f.FieldName);
                                            var options = f.OptionValue.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries);
                                            foreach (var o in options)
                                            {
                                                <input type="radio"  value=@o  > @o </input>
                                             }
                                        }
                                    </div>

                                }
                                else if (f.ControlType == "multipleselection")
                                {
                                    <div class="multipleselection">
                                        @if (f.OptionValue != null)
                                        {
                                            @Html.Hidden(f.FieldName);
                                            var options = f.OptionValue.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries);

                                            foreach (var o in options)
                                            {
                                            <input id=@f.FieldName type="checkbox" value=@o   >@o </input>
                                             }
                                        }
                                    </div>
                                }
                                else if (f.ControlType == "richtext")
                                {
                                   
                                    <textarea id=@f.FieldName name="@f.FieldName"></textarea>
                                  
                                }
                                else if (f.ControlType == "dropdownlist")
                                {
                                    <div>
                                        @if (f.OptionValue != null)
                                        {
                                            @Html.Hidden(f.FieldName);
                                            var options = f.OptionValue.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries);
                                            <select id=@f.FieldName>
                                                <option>--请选择--</option>
                                                @foreach (var o in options)
                                                {
                                                    <option>@o</option>
                                                }
                                            </select>
                                        }
                                    </div>
                                }
                           </li>       
                        
                            }
                        }
                        }
                    </ul>
                </td>
            </tr>
        </table>
    </fieldset>

    <fieldset class="preview-fieldset">
        <legend>审批结果</legend>
        <ul class='approveul'>
        </ul>
        @*    <center>
        <div id="radio">
            <input type="radio" id="radio1" name="radio" /><label for="radio1">同意</label>
            <input type="radio" id="radio2" name="radio" checked="checked" /><label for="radio2">不同意</label>
            <input type="radio" id="radio3" name="radio" /><label for="radio3">不同意但继续</label>
        </div>
    </center>*@
        <center id="appbutons">
            <input type="submit" id="pre-start" value="发起流程" /></center>
    </fieldset>
}
